#pragma once

#ifndef ROOT_TGTab
#include <TGTab.h>
#endif

#ifndef ROOT_TGTextView
#include <TGTextView.h>
#endif

#ifndef ROOT_TGLabel
#include <TGLabel.h>
#endif

#ifndef ROOT_TGTextEntry
#include <TGTextEntry.h>
#endif

#ifndef ROOT_TCanvas
#include <TCanvas.h>
#endif

#ifndef ROOT_TGraphErrors
#include <TGraphErrors.h>
#endif

#include <TMultiGraph.h>

#include "ArchiveWrapper.h"

#include "ValueWithError.h"

#include <string>

class MeasureTab
{
public:
    MeasureTab(void);
    ~MeasureTab(void);

    void Create( TGTab * fMainTabs, void *appPtr, std::string arcName );
    void PrintData(ValueWithError Te, ValueWithError Ne, bool correction = true);
    void DrawData(std::vector<std::pair<double, double> > line, std::vector<std::pair<double, ValueWithError> > points, bool correction = true);
    void ClearData ();

    std::string GetArcName();
    void SetArcName(std::string arcName) { m_archiveName->SetText(arcName.c_str()); };
    
    int GetShotNum();
    void SetWarningText(std::string text);
    void ClearWarning () {m_warning->Clear();};

private:
    bool Draw(std::vector<std::pair<double, double> > line, std::vector<std::pair<double, ValueWithError> > points,
                        TGraph *grLine, TGraphErrors *grPoints);
private:
    TGTextEntry *m_archiveName;
    TGTextEntry *m_shotNumber;

    TGLabel *m_temperatureVal;
    TGLabel *m_temperatureValNoCorrection;
    TGLabel *m_densityVal;
    TGLabel *m_densityValNoCorrection;
    TGLabel *m_correction;

    TGTextView *m_warning;
    TCanvas *m_canvas;

    TGraph *m_grChanelWidth;
    TGraph *m_gr;
    TGraphErrors *m_pointsChanelWidth;
    TGraphErrors *m_points;
};

